/* eslint-disable react/no-unused-state */
import React, { PureComponent } from 'react';
import ImageUpload from '../../../components/ImageUpload';

export default class Test2 extends PureComponent {
  state: Readonly<any> = {
    imageIds: [],
    imageUrls: [],
    imageAllData: [],
  };

  // 这些是可选的， 目前只用得到 imageIds， [1,2,3,3,4]
  handlerChangeImgIds = (imageIds: string[]) => {
    this.setState({ imageIds }, () => {
      //  window.console.log((this.state.imageIds, 'imageIds');
    });
  };

  handlerChangeImgUrls = (imageUrls: string[]) => {
    this.setState({ imageUrls }, () => {
      //  window.console.log((this.state.imageUrls, 'imageUrls');
    });
  };

  handlerChangeImgAllData = (imageAllData: object[]) => {
    this.setState({ imageAllData }, () => {
      //  window.console.log((this.state.imageAllData, 'imageAllData');
    });
  };

  render() {
    return (
      <div>
        <ImageUpload
          imageLength={3}
          handlerChangeImgIds={this.handlerChangeImgIds}
          handlerChangeImgUrls={this.handlerChangeImgUrls}
          handlerChangeImgAllData={this.handlerChangeImgAllData}
        ></ImageUpload>
      </div>
    );
  }
}
